package com.nblog.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.jfinal.plugin.ehcache.CacheKit;
import com.nblog.cache.CacheName;
import com.nblog.model.SysConfig;
import com.nblog.plugin.ioc.annotation.JFService;

@JFService
public class SysConfigService {
	public Map<String,Object> getConfig(){
		List<SysConfig> list=CacheKit.get(CacheName.sysConfigCache, "all");
		if(list==null||list.size()==0){
			list=SysConfig.dao.find("select * from sys_config");
			CacheKit.put(CacheName.sysConfigCache, "all", list);
		}
		Map<String,Object> webinfo=new HashMap<String,Object>();
		for(SysConfig config:list){
			webinfo.put(config.getKey(), config.getValue());
		}
		return webinfo;
	}
}
